﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System
{
  public static class DoubleExtensions
  {
    public static double PercentOf(this double a, double b)
    {
      return (a / b) * 100;
    }

    public static double PercentOf(this double a, double b, int round)
    {
      return Math.Round((a / b) * 100,round);
    }

    public static double SafeDivide(this double a, double b)
    {
      return (b == 0) ? 0 : a / b;
    }
  }
}
